<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class c_index extends CI_Controller {

	function __construct(){
		parent::__construct();	
		$this->load->model("m_public_function");
		checkLogin();
	}
	
	function index(){
		$task = secure_post("task");
		if ($task == "home"){
			$this->load->view('v_home',null);
		}else{
            $flowbyuser = $this->m_public_function->flowbyuser($_SESSION[SESSION_USERID]);
            $data['alert'] = array();
            for($i=0;$i<count($flowbyuser);$i++){
                $notifflow = $this->m_public_function->notifflow($flowbyuser[$i]->flow_id);
                for($j=0;$j<count($notifflow);$j++){
                    $data['alert'][] = $notifflow[$j];
                }
            }
			$data['main_menus'] = $this->m_public_function->_main_menus();
			$data['menus'] = $this->m_public_function->_menus();
			// $data['content'] = $this->load->view('v_groups',null,true);
			$this->load->view('v_main',$data);
		}
	}
	
}